#include "doublelinklist.h"
#define _CRTDBG_MAP_ALLOC
template<class DT>
typename doublelinkedlist<DT>::iterator find(doublelinkedlist <DT>& list, DT _val);
int main() {
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	doublelinkedlist<int> L;
	for (int i = 1; i <= 5; i++)
		L.push_back(i);
	L.display();
	typename doublelinkedlist<int>::iterator iter = find(L, 3);
	if (iter != L.end())
		L.erase(iter);
	L.display();
	iter = find(L, 3);
}


template<class DT>
typename doublelinkedlist<DT>::iterator find(doublelinkedlist <DT>& list, DT _val)
{
	typename doublelinkedlist<DT>::iterator cur = list.begin();
	while (cur != list.end()) {
		if (*cur == _val) {
			return cur;
		}
		cur++;
	}
	return list.end();
}